package com.ujoku.controller;

import com.labillusion.core.platform.web.rest.RESTController;
import com.ujoku.domain.Region;
import com.ujoku.service.RegionService;
import com.ujoku.view.domain.RegionView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created by Andy.Lian on 2014/11/5.
 */
@RestController
public class RegionController extends RESTController {

    @Autowired
    protected RegionService regionService;

    @RequestMapping(value="/region", method = RequestMethod.GET)
    @ResponseBody
    public RegionView getRegionList(HttpServletRequest request)  throws Exception {
        List<Region> regions=regionService.selectList();

        RegionView regionView=new RegionView(regions);
        return regionView;
    }
}
